home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / SWAG / SWAGA_C / CHARS.SWG / 0010_Character Booleans.pas < prev   
Pascal/Delphi Source File  |  1995-03-03  |  3KB  |  82 lines

  1. unit IS;
  2.  
  3. Interface
  4.  
  5. function IsLower (c:char):boolean;
  6.  {Returns true of c is a lower case letter}
  7.  
  8. Inline(                  {Assembly by Inline 01/12/88 23:45}
  9.   $59/                   {     pop  cx        ;recover argument}
  10.   $B0/$00/               {     mov  al,0      ;establish false return}
  11.   $80/$F9/$61/           {     cmp  cl,'a'}
  12.   $72/$07/               {     jb   done}
  13.   $80/$F9/$7A/           {     cmp  cl,'z'}
  14.   $77/$02/               {     ja   done}
  15.   $B0/$01                {     mov  al,1      ;true}
  16.  );                      {done:}
  17.  
  18. function IsUpper (c:char):boolean;
  19.   {returns true if c is an upper case letter}
  20.  
  21. Inline(                  {Assembly by Inline 01/12/88 23:45}
  22.   $59/                   {     pop  cx        ;recover argument}
  23.   $B0/$00/               {     mov  al,0      ;establish false return}
  24.   $80/$F9/$41/           {     cmp  cl,'A'}
  25.   $72/$07/               {     jb   done}
  26.   $80/$F9/$5A/           {     cmp  cl,'Z'}
  27.   $77/$02/               {     ja   done}
  28.   $B0/$01                {     mov  al,1      ;true}
  29.  );                      {done:}
  30.  
  31. function IsDigit (c:char):boolean;
  32.   {returns true if c is a digit, i.e., 0-9}
  33.  
  34. Inline(                  {Assembly by Inline 01/12/88 23:45}
  35.   $59/                   {     pop  cx        ;recover argument}
  36.   $B0/$00/               {     mov  al,0      ;establish false return}
  37.   $80/$F9/$30/           {     cmp  cl,'0'}
  38.   $72/$07/               {     jb   done}
  39.   $80/$F9/$39/           {     cmp  cl,'9'}
  40.   $77/$02/               {     ja   done}
  41.   $B0/$01                {     mov  al,1      ;true}
  42.  );                      {done:}
  43.  
  44. Function IsAlpha(c:char):boolean;
  45.  {returns true if c is an upper or lower case letter}
  46. Inline(                  {Assembly by Inline 01/12/88 23:45}
  47.   $59/                   {          pop  cx}
  48.   $B0/$00/               {          mov  al,0}
  49.   $80/$F9/$41/           {          cmp  cl,'A'}
  50.   $72/$11/               {          jb   done}
  51.   $80/$F9/$5A/           {          cmp  cl,'Z'}
  52.   $76/$0A/               {          jbe  OK}
  53.   $80/$F9/$61/           {          cmp  cl, 'a'}
  54.   $72/$07/               {          jb   done}
  55.   $80/$F9/$7A/           {          cmp  cl,'z'}
  56.   $77/$02/               {          ja   done}
  57.   $B0/$01                {  OK:     mov  al,1}
  58.  );                      {  done:}
  59. Function IsAlNum(c:char):boolean;
  60.  {returns true if c is a letter or a digit}
  61. Inline(                  {Assembly by Inline 01/12/88 23:45}
  62.   $59/                   {          pop  cx}
  63.   $B0/$00/               {          mov  al,0}
  64.   $80/$F9/$30/           {          cmp  cl,'0'}
  65.   $72/$1B/               {          jb   done}
  66.   $80/$F9/$39/           {          cmp  cl, '9'}
  67.   $76/$14/               {          jbe  OK}
  68.   $80/$F9/$41/           {          cmp  cl,'A'}
  69.   $72/$11/               {          jb   done}
  70.   $80/$F9/$5A/           {          cmp  cl,'Z'}
  71.   $76/$0A/               {          jbe  OK}
  72.   $80/$F9/$61/           {          cmp  cl, 'a'}
  73.   $72/$07/               {          jb   done}
  74.   $80/$F9/$7A/           {          cmp  cl,'z'}
  75.   $77/$02/               {          ja   done}
  76.   $B0/$01                {  OK:     mov  al,1}
  77.  );                      {  done:}
  78.  
  79.  
  80. Implementation
  81. end.
  82.